<?php
namespace Profile;

\think\Loader::import('controller/Jump', TRAIT_PATH, EXT);
use Profile;
use think\Db;
use think\Session;
use think\Cookie;
use Dm\Request\V20151123 as Dm;            

class DefaultProfile
{	
	
  
	public function send_email(){
		$email = $_POST['email'];
		$user_id = $_POST['user_id'];//用户id
		$user_name = Session::get('name');//用户名
		
$content = "";
$content .= <<<STR
您好：{$user_name}!
<br /><br />
您正在进行拾友旅游邮箱绑定，请点击一下链接完成绑定：
<br /><br />
<a href="http://www.tour.com/index/personal/email?email={$email}&user_id={$user_id}">点我绑定邮箱哟~</a>
STR;

//		include APP_PATH.'index/controller/core/test.php';exit;
//	    include_once APP_PATH.'index/controller/core/Config.php';
	    $iClientProfile = new \DefaultProfile();
	    $iClientProfile::getProfile("cn-hangzhou", "LTAI4JFTraQjomTV", "jXR9FpGrrnJt08YHdnzaOmhDiG2Nj8");        
	    $client = new DefaultAcsClient($iClientProfile);    
	    $request = new Dm\SingleSendMailRequest();     
		
	    $request->setAccountName("tour@mail.cnhccm.com");
	    $request->setFromAlias("Dave");
	    $request->setAddressType(1);
	    $request->setTagName("tour");
	    $request->setReplyToAddress("true");
	    $request->setToAddress("$email");        
	    $request->setSubject("拾友旅游");
	    $request->setHtmlBody($content);        
	    try {
	        $response = $client->getAcsResponse($request);
	        print_r($response);
	    }
	    catch (ClientException  $e) {
	        print_r($e->getErrorCode());   
	        print_r($e->getErrorMessage());   
	    }
	    catch (ServerException  $e) {        
	        print_r($e->getErrorCode());   
	        print_r($e->getErrorMessage());
	    }
	}
}
?>